package chapter4;
import java.util.Scanner;
/****************************************************************
 * Author：icynlau
 * Description: 计算酬金
 * 			注意格式化输出%时 %%
 * Date:2021/4/2
 * ***************************************************************
 */
public class exc4_23 {
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		System.out.print("Enter employee's Name:  ");
		String name=input.nextLine();
		System.out.print("Enter number of hours worked in a week:  ");
		String sHour=input.next();
		double  nHour=Double.parseDouble(sHour);
		System.out.print("Enter hourly pay rate:  ");
		String sPayRate=input.next();
		double nPayRate=Double.parseDouble(sPayRate);
		System.out.print("Enter federal tax withholding rate:  ");
		String sFRate=input.next();
		double nFRate=Double.parseDouble(sFRate);
		System.out.print("Enter state tax withholding rate:  ");
		String sSRate=input.next();
		double nSRate=Double.parseDouble(sSRate);
		
		System.out.println("Employee Name: "+name);
		System.out.printf("Hours Worked : %.1f\n", nHour);
		System.out.printf("Pay Rate: $%.2f\n",nPayRate);
		System.out.printf("Gross Pay: $ %.2f\n", nPayRate*nHour);
		System.out.printf("Deductions:\n");
		System.out.printf("\tFederal Withholding (%.1f %%):  $ %.2f\n", nFRate*100.0,nPayRate*nHour*nFRate);
		System.out.printf("\tState Withholding (%.1f %%):  $ %.2f\n", nSRate*100.0,nPayRate*nHour*nSRate);
		System.out.printf("\tTotal Deduction :  $ %.2f\n",nPayRate*nHour*(nSRate+nFRate));
		System.out.printf("Net Pay : $ %.2f\n",nPayRate*nHour*(1-(nSRate+nFRate)));
		
	}

}
